//
// RS Game Framework
// Copyright © 2010 Jedd Haberstro
// jhaberstro@gmail.com
// 
// $Id:
//

#ifndef RS_GRAPHICS_GRAPHICSFORWARDS_HPP
#define RS_GRAPHICS_GRAPHICSFORWARDS_HPP

#include "rs/SmartPointer.hpp"

namespace rs
{
    namespace graphics
    {        
        class Buffer;
        class BufferDescription;
        class GraphicsContext;
        class Image;
        class Renderer;
        class Resource;
        class ResourceDescription;
        class Shader;
        class ShaderDescription;
        class Texture2D;
        class Texture2DDescription;
		class TextureFormat;
        class VertexFormat;
        
        
        typedef SmartPointer< Buffer > BufferPtr;
        typedef SmartPointer< GraphicsContext > GraphicsContextPtr;
        typedef SmartPointer< Image > ImagePtr;
        typedef SmartPointer< Renderer > RendererPtr;
        typedef SmartPointer< Resource > ResourcePtr;
        typedef SmartPointer< Shader > ShaderPtr;
        typedef SmartPointer< Texture2D > Texture2DPtr;
        typedef SmartPointer< VertexFormat > VertexFormatPtr;
        
        
        namespace InputElementFormat
        {
            enum Enum
            {
                SInt8,
                UInt8,
                SInt16,
                UInt16,
                SInt32,
                UInt32,
                Float16,
                Float32,
                Double
            };
        }
        
        namespace PrimitiveTopology
        {
            enum Enum
            {
                Points,
                LineStrip,
                LineLoop,
                Lines,
                TriangleStrip,
                TriangleFan,
                Triangles,
                Quads,
            };
        }
        
        namespace ResourceAccess
        {
            enum Enum
            {
                None      = 0x00000000,
                Read      = 0x00000001,
                Write     = 0x00000002,
                ReadWrite = 0x00000004
            };
        }
        
        namespace ResourceType
        {
            enum Enum
            {
                Unknown             = 0x00000000,
                DepthStencilBuffer  = 0x00000001,
                IndexBuffer         = 0x00000002,
                RenderTarget        = 0x00000004,
                ShaderResource      = 0x00000008,
                Texture2D           = 0x00000010,
                ConstantBuffer      = 0x00000020,
                VertexBuffer        = 0x00000040
            };
        }
        
        namespace ResourceUsage
        {
            enum Enum
            {
                Default = 0x00000000,
                Static  = 0x00000001,
                Dynamic = 0x00000002,
                Stream  = 0x00000004
            };
        }
        
        
        struct InputElement
        {
            Char const* name;
            UInt8 semanticIndex;
            InputElementFormat::Enum format;
            UInt8 componentCount;
            UInt32 offset;
            UInt32 stream; // inputSlot
        };
        
        inline UInt32 GetInputElementFormatSize(InputElementFormat::Enum format) {
            static UInt32 const sizes[] =
            {
                sizeof(Int8), sizeof(UInt8),
                sizeof(Int16), sizeof(UInt16),
                sizeof(Int32), sizeof(UInt32),
                sizeof(Int16), sizeof(Float),
                sizeof(Double)
            };
            
            UInt32 result = sizes[format];
            return result;
        }
    }
}

#endif // RS_GRAPHICS_GRAPHICSFORWARDS_HPP
